#include <iostream>
#include <memory>
#include "UdpServer.hpp"
#include "MessageRoute.hpp"

void Usage(std::string pro)
{
    std::cout << "Usage:\n\t" << pro << "local_port\n";
}
int main(int argn, char* argv[])
{
    if (argn < 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }
    EnableScreen();
    //std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);
    //MessageRoute模块
    MessageRoute msr;

    //网络模块
    std::unique_ptr<UdpServer> us_ptr = std::make_unique<UdpServer>(port, \
    std::bind(&MessageRoute::Route, msr, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
    
    us_ptr->Init();
    us_ptr->Start();
}